import React from 'react'

export default function SuperCheckout({ label, checked, onChange, state, currentValue, className}) {
  const handleChange = (e) => {
    if (state) {
      onChange(e.target.checked);
    }
  };
  return (
    <fieldset className={`fieldset border border-gray-300 rounded-xs w-1/2 px-4 pt-1 pb-3 mb-2 ${className}`}>
      <legend className="fieldset-legend text-black text-sm font-normal">{label}：</legend>
      <label className="label">
        <input type="checkbox" checked={checked} disabled={!state} onChange={handleChange} className="checkbox rounded-xs border-gray-300" />
        {currentValue}
      </label>
    </fieldset>
  )
}
